/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t_frcmd_client_print.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2015/01/04 by geyh                                 */
/*******************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <CUnit/Basic.h>
#include <CUnit/CUnit.h>
#include <protobuf-c/protobuf-c.h>

#include "../../comm/frcmd_parse_detail.h"
#include "../../comm/client.pb-c.h"
#include "../../comm/frcmd_parse.h"
#include "../../comm/apm.pb-c.h"
#include "../../comm/frcmd_client.h"
#include "../../comm/frcomm.h"
#include "../../comm/frmem.h"
#include "../../comm/frsutl.h"
#include "../../comm/apmtest_cunit.h"

extern int g_i_port;
extern char* g_p_server;

static int __suite_init(void)
{
	return 0;
}

static int __suite_cleanup(void)
{
	return 0;
}


void case1(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("system");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case2(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("topology");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case3(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("thread");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}
/*
void case4(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("module");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}
*/
void case5(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("server");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case6(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("filter");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case7(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("l7_default");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case8(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("java");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

void case9(void)
{
    int i_ret = 0;

    g_p_server = "127.0.0.1";
    g_i_port = 65535;

    i_ret = frcmd_client_print("memory");

    CU_ASSERT_EQUAL(i_ret,FR_SUCC)

}

int add_suite()
{
	CU_pSuite pSuite = NULL;

	pSuite = CU_add_suite("t_frcmd_client_print 测试", __suite_init, __suite_cleanup);

	if (NULL == pSuite)
	{
		return 1;
	}


    //增加测试用例
   	CU_add_test(pSuite, "case1", case1);
   	CU_add_test(pSuite, "case2", case2);
   	CU_add_test(pSuite, "case3", case3);
   //	CU_add_test(pSuite, "case4", case4);
    CU_add_test(pSuite, "case5", case5);
    CU_add_test(pSuite, "case6", case6);
    CU_add_test(pSuite, "case7", case7);
    CU_add_test(pSuite, "case8", case8);
    CU_add_test(pSuite, "case9", case9);

    return 0;

}

int main(int argc, char **argv)
{
    frmem_init();
    run_cunit(add_suite);
    frshow_leak();
    frmem_destroy();
    return 0;
}